<?php

function check_date($str){
	if(empty($str)){echo "<script>alert('时间输入为能为空!');</script>";break;}
	$check_str= explode("-",$str);
    $M=intval($check_str[1]);
    $d=intval($check_str[2]);
    $Y=intval($check_str[0]);
        if(checkdate($M,$d,$Y)){
    	   return $str;
        }
	    else{
	    	echo "<script>alert('时间格式输入有误!');</script>";
	    	break;
	    }
	
}
?>
